#include "T_Mutex.h"
#include <Windows.h>

class Mutex:public T_Mutex{
public:
	virtual void Lock(){
		EnterCriticalSection(&m_section);
	}
	virtual bool TryLock(){
		EnterCriticalSection(&m_section);
		return true;
	}
	virtual void Unlock(){
		LeaveCriticalSection(&m_section);
	}

public:
	Mutex(){
		InitializeCriticalSection(&m_section);
	}
	virtual ~Mutex(){
		DeleteCriticalSection(&m_section);
	}
protected:
	CRITICAL_SECTION m_section;
};

T_Mutex *T_Mutex::create(){
	return (T_Mutex *)new Mutex();
}